#ifndef nsGB2312Prober_h__
#define nsGB2312Prober_h__

#include "nsCharSetProber.h"
#include "nsCodingStateMachine.h"
#include "CharDistribution.h"


class nsGB18030Prober: public nsCharSetProber {
  public:
    nsGB18030Prober( bool aIsPreferredLanguage )
      : mIsPreferredLanguage( aIsPreferredLanguage ) {
      mCodingSM = new nsCodingStateMachine( &GB18030SMModel );
      Reset();
    }
    virtual ~nsGB18030Prober( void ) {delete mCodingSM;}
    nsProbingState HandleData( const char* aBuf, uint32_t aLen );
    const char* GetCharSetName() {return "gb18030";}
    nsProbingState GetState( void ) {return mState;}
    void      Reset( void );
    float     GetConfidence( void );

  protected:
    void      GetDistribution( uint32_t aCharLen, const char* aStr );

    nsCodingStateMachine* mCodingSM;
    nsProbingState mState;


    GB2312DistributionAnalysis mDistributionAnalyser;
    char mLastChar[2];
    bool mIsPreferredLanguage;

};


#endif
